//


import UIKit

class TabBarViewController: UITabBarController,UITabBarControllerDelegate {
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view.
        
        AddChiController(childVc: MainViewController(), childtitle: "Home", imgname: "uuuu", selectImgname: "uuuu")
        AddChiController(childVc: SettingViewController(), childtitle: "Set", imgname: "uuuu", selectImgname: "uuuu")
        
    }
    
    func AddChiController (childVc:UIViewController, childtitle:String,imgname:String,selectImgname:String ) {
        //
        childVc.tabBarItem = UITabBarItem(title: childtitle, image: UIImage(named: imgname)?.withRenderingMode(.alwaysOriginal), selectedImage: UIImage(named: selectImgname)?.withRenderingMode(.alwaysOriginal))
        
        let navgation = UINavigationController(rootViewController: childVc)
        self.addChild(navgation)
        
    childVc.tabBarItem.setTitleTextAttributes([NSAttributedString.Key.foregroundColor:UIColor.black], for: .normal)
    childVc.tabBarItem.setTitleTextAttributes([NSAttributedString.Key.foregroundColor:UIColor.red], for: .selected)
        
        
    }
    
    /*
     // MARK: - Navigation
     
     // In a storyboard-based application, you will often want to do a little preparation before navigation
     override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
     // Get the new view controller using segue.destination.
     // Pass the selected object to the new view controller.
     }
     */
    
}
